package com.hxzy.teststructproject;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.sam.test.struct.R;

public class MainActivity extends AppCompatActivity {

    private SharedPreferences sharedPreferences;
    private SharedPreferences.Editor editor;
    private View btn1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        sharedPreferences = getSharedPreferences("text_mssj", Context.MODE_PRIVATE);
        editor = sharedPreferences.edit();
        btn1 = findViewById(R.id.btn1);

    }

    public void writeSP(View view) {
    editor.putBoolean("isHuman",true);
        editor.putFloat("height",2.2f);
        editor.putInt("age",24);
        editor.commit();

    }


}

